<?php
/*
 * name: gsl
 * desc: 平台权限 迁移表
 * date: 2018/09/21
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateAdminPermissionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_permission', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->integer('pid')->nullable()->comment('父id');
            $table->string('path')->comment('路径');
            $table->tinyInteger('level')->default(1)->comment('等级');
            $table->integer('fid')->nullable()->comment('附属权限id');
            $table->string('icon',20)->comment('图标');
            $table->string('name',50)->comment('名称');
            $table->tinyInteger('menu_switch')->default(1)->comment('是否显示菜单 1隐藏 2显示');
            $table->integer('sort')->default(1)->comment('排序');
            $table->string('http_method', 50)->nullable()->comment('访问方式');
            $table->string('http_path', 255)->nullable()->comment('地址');
            $table->string('url')->comment('');
            $table->string('slug')->nullable()->comment('标识');
            $table->timestamps();
             $table->softDeletes();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."admin_permission` comment'平台权限'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_permission');
    }
}
